package guoanmaker.personal.business.model;

import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.alibaba.fastjson.annotation.JSONField;

import guoanmaker.personal.helper.common.abstractobj.IdEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 
 * @author ZJ
 *
 *         优惠券实体类
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "t_operator_coupons")
public class OperatorCoupons extends IdEntity {
	@Column(name="couponsname")
	private String couponsname; // 优惠券名称
    @Column(name="oprange")
	private String oprange; // 范围
    @Column(name="getway")
	private String getway; // 领取方式
    @Column(name="time_type")
	private String timeType; //  1---------》 时间范围（存1 有时间范围）
    @Column(name="startcouponstime")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date startcouponstime;// 优惠券领取起始时间   *
    @Column(name="endcouponstime")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date endcouponstime;// 优惠券领取结束时间   *
    @Column(name="couponstype")
	private String couponstype;// 优惠券类型 0 ：直减 1：满减 2：打折  3:累加直减
    @Column(name="lapseamount")
	private Double lapseamount; // 直减金额
    @Column(name="fullamount")
	private Double fullamount; //满（）金额
    @Column(name="subamount")
	private Double subamount;//减（）金额
    @Column(name="discount")
	private Double discount;//折扣率
    @Column(name="issuenumber")
	private int issuenumber;// 发行数量        0 代表没有数量限制   *
    @Column(name="validity_period")
	private int validityPeriod; // 有效期多少天
    @Column(name="eachcoupons")
	private int eachcoupons;// 每人送几张
    @Column(name="iseffect")
	private int iseffect;//是否生效    0----》未生效   1-----》已生效  *
    @Column(name="totalcost")
	private Double totalcost;//总成本
    @Column(name="beensent")
    private int   beensent; //已送
    @Column(name="beenused")
    private int   beenused; //已用
    @Column(name="createuser")
    private String createuser;//创建人
    @Column(name="createdate")
    private Date createdate;//创建时间
    
    private int delestatus; //删除状态     1代表删除     *
    
    @DateTimeFormat(pattern = "yyyy-MM-dd") 
    private Date  endofdate;//优惠券截止时间（年月日时分秒）
    
    private String  datetype;//日期类型      1代表是有截止日期     0为有效期
    
    private String vouchtype; //  1位注册送   2为抽奖送  3为累积签到送  4为连续签到送
    private String serverid;  //二级业务分类ID   为空的时候存0
    private String servername;//二级业务分类名称
    private  Double   sumlapseamount;  //累加直减金额
    
    @OneToMany(mappedBy="operatorCoupon",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
	@JSONField(serialize=false)
	private List<PersonalUserCoupon> puCoupons;
 

}
